#!/usr/bin/env python
# coding=utf-8
#-------------------------------------------------------------------------------
# Name:        模块1
# Purpose:
#
# Author:      vavava
#
# Created:     05/11/2012
# Copyright:   (c) vavava 2012
# Licence:     <your licence>
#-------------------------------------------------------------------------------

__author__ = 'vavava'


class LogAdapter(object):

    def __init__(self,log=None,name="<?>"):
        self._log = log
        self._name=name

    def info(self,arg):
        if self._log:
            self._log.info(arg)
        else:
            print('[',self._name,'(info)]',arg)

    def warn(self,arg):
        if self._log:
            self._log.warn(arg)
        else:
            print('[',self._name,'(warm)]',arg)

    def error(self,arg):
        if self._log:
            self._log.error(arg)
        else:
            print('[',self._name,'(error)]',arg)

    def debug(self,arg):
        if self._log:
            self._log.debug(arg)
        else:
            print('[',self._name,'(debug)]',arg)

    def exception(self,e):
        if self._log:
            self._log.exception(e)
        else:
            print('[',self._name,'(exception)]',e)

